package com.example.testlist.widget.viewpager0;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import com.example.testlist.R;

public class ViewPagerTest0 extends LinearLayout {

    private Context mContext;

    private ViewPager mViewPager;

    private CardPagerAdapter mCardAdapter;
    private ShadowTransformer mCardShadowTransformer;


    public ViewPagerTest0(Context context) {
        this(context,null);
    }

    public ViewPagerTest0(Context context,AttributeSet attrs) {
        this(context, attrs,0);
    }

    public ViewPagerTest0(Context context,AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        mContext = getContext();

        inflate(mContext, R.layout.viewpager_test0,this);


        mViewPager = findViewById(R.id.viewPager);

        mCardAdapter = new CardPagerAdapter();
        mCardAdapter.addCardItem(new CardItem(R.string.app_name, R.string.text_1));
        mCardAdapter.addCardItem(new CardItem(R.string.app_name, R.string.text_1));
        mCardAdapter.addCardItem(new CardItem(R.string.app_name, R.string.text_1));
        mCardAdapter.addCardItem(new CardItem(R.string.app_name, R.string.text_1));

        mCardShadowTransformer = new ShadowTransformer(mViewPager, mCardAdapter);
        mCardShadowTransformer.enableScaling(true);

        mViewPager.setAdapter(mCardAdapter);
        mViewPager.setPageTransformer(false, mCardShadowTransformer);
        mViewPager.setOffscreenPageLimit(3);




    }
}
